home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / PInterfaces / Types.p < prev    next >
Encoding:
Text File  |  1994-07-21  |  5.7 KB  |  303 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Types.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.1  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Types;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __TYPES__}
  27. {$SETC __TYPES__ := 1}
  28.  
  29. {$I+}
  30. {$SETC TypesIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37.  
  38. {$PUSH}
  39. {$ALIGN MAC68K}
  40. {$LibExport+}
  41.  
  42. CONST
  43.     noErr                        = 0;
  44.  
  45.     
  46. TYPE
  47. Byte = 0..255;
  48.  
  49.     SignedByte = -128..127;
  50.  
  51.     UInt8 = Byte;
  52.  
  53.     SInt8 = SignedByte;
  54.  
  55.     UInt16 = INTEGER;
  56.  
  57.     SInt16 = INTEGER;
  58.  
  59.     UInt32 = LONGINT;
  60.  
  61.     SInt32 = LONGINT;
  62.  
  63.     ByteParameter = SignedByte;
  64.  
  65.     Ptr = ^SignedByte;
  66.  
  67. {  pointer to a master pointer }
  68.     Handle = ^Ptr;
  69.  
  70. {$IFC UNDEFINED qMacApp }
  71.     IntegerPtr = ^INTEGER;
  72.  
  73.     LongIntPtr = ^LONGINT;
  74.  
  75. {$ENDC}
  76.     Fixed = LONGINT;
  77.  
  78.     FixedPtr = ^Fixed;
  79.  
  80.     Fract = LONGINT;
  81.  
  82.     FractPtr = ^Fract;
  83.  
  84.     _extended80 = RECORD
  85.         exp:                    INTEGER;
  86.         man:                    ARRAY [0..3] OF INTEGER;
  87.     END;
  88.     _extended96 = RECORD
  89.         exp:                    ARRAY [0..1] OF INTEGER;
  90.         man:                    ARRAY [0..3] OF INTEGER;
  91.     END;
  92. {$IFC GENERATING68K }
  93. Note: on PowerPC extended is undefined.
  94.       on 68K when mc68881 is on, extended is 96 bits.  
  95.              when mc68881 is off, extended is 80 bits.  
  96.       Some old toolbox routines require an 80 bit extended so we define extended80
  97. }
  98. {$IFC GENERATING68881 }
  99.     extended80 = _extended80;
  100.  
  101.     extended96 = extended;
  102.  
  103. {$ELSEC}
  104.     extended80 = extended;
  105.  
  106.     extended96 = _extended96;
  107.  
  108. {$ENDC}
  109. {$ELSEC}
  110.     extended80 = _extended80;
  111.  
  112.     extended96 = _extended96;
  113.  
  114. {$ENDC}
  115. {
  116. Note: float_t and double_t are "natural" computational types
  117.       (i.e.the compiler/processor can most easily do floating point
  118.       operations with that type.) 
  119. }
  120. {$IFC GENERATINGPOWERPC }
  121. { on PowerPC, double = 64-bit which is fastest.  float = 32-bit }
  122.     float_t = Single;
  123.  
  124.     double_t = Double;
  125.  
  126. {$ELSEC}
  127. { on 68K, long double (a.k.a. extended) is always the fastest.  It is 80 or 96-bits }
  128.     float_t = extended;
  129.  
  130.     double_t = extended;
  131.  
  132. {$ENDC}
  133.     wide = RECORD
  134.         hi:                        SInt32;
  135.         lo:                        UInt32;
  136.     END;
  137.     WidePtr = ^wide;
  138.  
  139.     UnsignedWide = RECORD
  140.         hi:                        UInt32;
  141.         lo:                        UInt32;
  142.     END;
  143.     UnsignedWidePtr = ^UnsignedWide;
  144.  
  145.  
  146. CONST
  147.     v                            = 0;
  148.     h                            = 1;
  149.  
  150.     
  151. TYPE
  152. VHSelect = SInt8;
  153.  
  154.     ProcPtr = Ptr;
  155.  
  156.     Register68kProcPtr = ProcPtr;  { PROCEDURE ; }
  157.  
  158.     ProcHandle = ^ProcPtr;
  159.  
  160.     UniversalProcPtr = ProcPtr;
  161.     UniversalProcHandle = ^ProcPtr;
  162.  
  163.     Str255 = STRING[255];
  164.     Str63 = STRING[63];
  165.     Str32 = STRING[32];
  166.     Str31 = STRING[31];
  167.     Str27 = STRING[27];
  168.     Str15 = STRING[15];
  169.  
  170.     StringPtr = ^Str255;
  171.     StringHandle = ^StringPtr;
  172.  
  173. { A C string is a zero terminated array of bytes.  There is no length byte.
  174.     a CStringPtr is a pointer to a C string (e.g. char* )
  175.     a ConstCStringPtr is a CStringPtr whose contents cannot be changed (e.g. const char* )
  176. }
  177.     CStringPtr = Ptr;
  178.     ConstCStringPtr = Ptr;
  179.  
  180.     ConstStr255Param = Str255;
  181.  
  182.     ConstStr63Param = Str63;
  183.  
  184.     ConstStr32Param = Str32;
  185.  
  186.     ConstStr31Param = Str31;
  187.  
  188.     ConstStr27Param = Str27;
  189.  
  190.     ConstStr15Param = Str15;
  191.  
  192.     OSErr = INTEGER;
  193.  
  194.     ScriptCode = INTEGER;
  195.  
  196.     LangCode = INTEGER;
  197.  
  198. {$IFC UNDEFINED MWERKS }
  199.     FourCharCode =  PACKED ARRAY [1..4] OF CHAR;
  200. {$ELSEC}
  201.     FourCharCode =  UNSIGNEDLONG;
  202. {$ENDC}
  203.     StyleItem = (bold,italic,underline,outline,shadow,condense,extend);
  204.     Style = SET OF StyleItem;
  205.  
  206.     OSType = FourCharCode;
  207.  
  208.     ResType = FourCharCode;
  209.  
  210.     OSTypePtr = ^OSType;
  211.  
  212.     ResTypePtr = ^ResType;
  213.  
  214.     Point = RECORD
  215.         CASE INTEGER OF
  216.         0: (
  217.             v:                            INTEGER;
  218.             h:                            INTEGER;
  219.            );
  220.         1: (
  221.             vh:                            ARRAY [0..1] OF INTEGER;
  222.            );
  223.     END;
  224.  
  225.     PointPtr = ^Point;
  226.  
  227.     Rect = RECORD
  228.         CASE INTEGER OF
  229.         0: (
  230.             top:                        INTEGER;
  231.             left:                        INTEGER;
  232.             bottom:                        INTEGER;
  233.             right:                        INTEGER;
  234.            );
  235.         1: (
  236.             topLeft:                    Point;
  237.             botRight:                    Point;
  238.            );
  239.     END;
  240.  
  241.     RectPtr = ^Rect;
  242.  
  243. { Numeric version part of 'vers' resource }
  244.     NumVersion = PACKED RECORD
  245.         majorRev:                UInt8;                                    {1st part of version number in BCD}
  246.         minorAndBugRev:            UInt8;                                    {2nd & 3rd part of version number share a byte}
  247.         stage:                    UInt8;                                    {stage code: dev, alpha, beta, final}
  248.         nonRelRev:                UInt8;                                    {revision level of non-released version}
  249.     END;
  250. { 'vers' resource format }
  251.     VersRec = RECORD
  252.         numericVersion:            NumVersion;                                {encoded version number}
  253.         countryCode:            INTEGER;                                {country code from intl utilities}
  254.         shortVersion:            Str255;                                    {version number string - worst case}
  255.         reserved:                Str255;                                    {longMessage string packed after shortVersion}
  256.     END;
  257.     VersRecPtr = ^VersRec;
  258.     VersRecHndl = ^VersRecPtr;
  259.  
  260. { Note: the 0xA9FF and 0xABFF traps are conditionally inlined in a different manner 
  261.          so that CFM 68K applications can use them }
  262.  
  263. PROCEDURE Debugger;
  264.     {$IFC NOT GENERATINGCFM}
  265.     INLINE $A9FF;
  266.     {$ENDC}
  267. PROCEDURE DebugStr(debuggerMsg: ConstStr255Param);
  268.     {$IFC NOT GENERATINGCFM}
  269.     INLINE $ABFF;
  270.     {$ENDC}
  271. PROCEDURE Debugger68k;
  272.     {$IFC NOT GENERATINGCFM}
  273.     INLINE $A9FF;
  274.     {$ENDC}
  275. PROCEDURE DebugStr68k(debuggerMsg: ConstStr255Param);
  276.     {$IFC NOT GENERATINGCFM}
  277.     INLINE $ABFF;
  278.     {$ENDC}
  279. PROCEDURE SysBreak;
  280.     {$IFC NOT GENERATINGCFM}
  281.     INLINE $303C, $FE16, $A9C9;
  282.     {$ENDC}
  283. PROCEDURE SysBreakStr(debuggerMsg: ConstStr255Param);
  284.     {$IFC NOT GENERATINGCFM}
  285.     INLINE $303C, $FE15, $A9C9;
  286.     {$ENDC}
  287. PROCEDURE SysBreakFunc(debuggerMsg: ConstStr255Param);
  288.     {$IFC NOT GENERATINGCFM}
  289.     INLINE $303C, $FE14, $A9C9;
  290.     {$ENDC}
  291.  
  292. {$ALIGN RESET}
  293. {$POP}
  294.  
  295. {$SETC UsingIncludes := TypesIncludes}
  296.  
  297. {$ENDC} {__TYPES__}
  298.  
  299. {$IFC NOT UsingIncludes}
  300.  END.
  301. {$ENDC}
  302.